<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background-color: red;
        }

        .box2 {
            background-color: pink;
        }
    </style>
    </style>
</head>

<body>
    <!-- v-on指令 绑定事件 -->
    <div id="app">
        <img v-bind:src="url" alt="">
        <!-- 属性没有v-bind=“当作字符串” -->
        <!-- 如果给标签设置的不是一个字符串，都要加v-bind -->
        <img :src="url" @click="fn" v-model="isOk" alt="">
        <input type="text" :value="123">
        <input type="text" :checked="false">
        <!-- :class=[box2,box3]  动态class-->
        <div class="box" :class="{box2:isOk}" @click="isOk=!isOk">
            点我
        </div>

        <!-- 动态style -->
        <div :style="{color:isOk?'red':'blue'}" @click="isOk=!isOk">456
        </div>

    </div>



    <script src=" vue.js"></script>
    <script>
        new Vue({
            el: "#app",
            data: {
                color: "pink",
                isOk: true,
                url: "https://ts2.cn.mm.bing.net/th?id=ODL.85fa5be3cbe4f9c3287857679c22bb79&w=186&h=300&c=10&rs=1&qlt=99&bgcl=fffffe&r=0&o=6&pid=WrapstarImage"
            },
            methods: {
                fn() {
                    this.isOk = !this.isOk
                    if (this.isOk) {
                        this.url = "https://ts1.cn.mm.bing.net/th?id=OIP-C.NmLZ5_tuap4KjC12mRUcigHaHa&w=169&h=150&c=8&rs=1&qlt=90&o=6&pid=3.1&rm=2"
                    } else {
                        this.url = "https://ts2.cn.mm.bing.net/th?id=ODL.85fa5be3cbe4f9c3287857679c22bb79&w=186&h=300&c=10&rs=1&qlt=99&bgcl=fffffe&r=0&o=6&pid=WrapstarImage"
                    }

                },

            }

        });
    </script>
</body>

</html>